package com.yt.al.db;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

public class RunDao extends BaseDao{

	public int[] getRunTime()
	{
		int[] runTime = {0,0};
		Connection conn = getConnect();
		ResultSet rs;
		try {
			rs = conn.createStatement().executeQuery(
					"select top 1 * from TB_Run_Info order by newid()" );
			if (rs.next()) {
				Integer start = rs.getInt("starthour");
				Integer end = rs.getInt("endhour");
				runTime[0] = start;
				runTime[1] = end;
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				conn.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		if(runTime.length==0)
		{
			runTime[0] = 8;
			runTime[1] = 19;
		}
		
		return runTime;
		
	}
}
